from tortoise import fields
from datetime import datetime
from .base import BaseModel, TimestampMixin


class SysRoleDept(BaseModel, TimestampMixin):
    """角色和部门关联表"""

    id = fields.IntField(pk=True, description="主键ID")

    role_id = fields.BigIntField(description="角色ID")

    dept_id = fields.BigIntField(description="部门ID")

    create_by = fields.CharField(max_length=64, null=True, description="创建者")

    create_time = fields.DatetimeField(null=True, description="创建时间")

    update_by = fields.CharField(max_length=64, null=True, description="更新者")

    update_time = fields.DatetimeField(null=True, description="更新时间")

    status = fields.CharField(max_length=1, null=True, description="状态（0代表存在 2代表删除）")

    class Meta:
        table = "sys_role_dept"

    def __str__(self):
        return f"{self.id}"